package br.ufpb.esa.plataforma.controller;

import java.io.IOException;

import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.layout.AnchorPane;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;

public class DescricaoController extends AnchorPane{
	
	@FXML
	private AnchorPane pane;
	@FXML
	private TextFlow textflow;
	private Text texto;
	
	public DescricaoController(String descricao){
		FXMLLoader loader = new FXMLLoader();
        loader.setLocation(DescricaoController.class.getResource("/br/ufpb/esa/plataforma/view/SceneDescricao.fxml"));
        
		loader.setRoot(this);
		loader.setController(this);
	
		try {
			
			this.pane = (AnchorPane)loader.load();
		} catch (IOException exception) {
			throw new RuntimeException(exception);
		}
		
		this.texto = new Text(descricao);
		this.setTexto(this.texto);
	}
	
	public void setTexto(Text texto){
		this.textflow = new TextFlow(texto);
	}
	
	public AnchorPane getAnchorPane(){
		return this.pane;
	}
}
